#include <stdio.h>
#include <unistd.h>

int main()
{
    printf("--------begin------\n");
    pid_t ret = fork();
    if(ret < 0)
    {
        perror("fork");
        return 0;
    }
    else if(ret > 0)
    {
        //father
        while(1)
        {
            printf("i am father abcdef, pid=%d, ppid=%d\n", getpid(), getppid());
            sleep(2);
        }
    }
    else
    {
        while(1)
        {
            printf("i am child 123456, pid=%d, ppid=%d\n", getpid(), getppid());
            sleep(1);
        }
    }
    //printf("linux84 666\n");
    return 0;
}
